<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.fick.hibernate.model.*"%>
<%@ page import="com.fick.hibernate.dao.*" %>
<%@ include file="../tld/tlds.jsp"%>
<%   
    Userer userer = new Userer();
    UsererDAO userDao = new UsererDAO();
   try{
     userer = (Userer)userDao.findAll().get(0);
     }catch(Exception e){
       response.sendRedirect("error.jsp");
     }
 %>
<html>
	<head>
		<style>
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}

.STYLE2 {
	color: #666666
}

body {
	margin: 0px;
	font: normal 12px "宋体", "Verdana", "Arial", "Helvetica", "sans-serif";
	SCROLLBAR-FACE-COLOR: rgb(31, 111, 191);
	SCROLLBAR-HIGHLIGHT-COLOR: rgb(31, 111, 191);
	SCROLLBAR-SHADOW-COLOR: rgb(10, 0, 209);
	SCROLLBAR-3DLIGHT-COLOR: rgb(23, 121, 255);
	SCROLLBAR-ARROW-COLOR: rgb(2, 51, 138);
	SCROLLBAR-TRACK-COLOR: rgb(46, 131, 215);
	SCROLLBAR-BASE-COLOR: rgb(46, 131, 215);
}
</style>
		<link href="css/css.css" rel="stylesheet"  type="text/css" />
		<script type="text/javascript" src="images/visidate.js"></script>
		<script type="text/javascript">
		  function selectAll(){
		      var myCheckBox = document.getElementsByName("MyCheckBox");         
		      for(var i=0;i<myCheckBox.length;i++){
		         myCheckBox[i].checked = true;
		        }
		    }
		   function sendInfo(){
		     
		      if(document.getElementById("content").value == ""){
		         alert("请输入内容");
		         return false;
		      }
		      var content = document.getElementById("content").value;
		      var userName = "<%=userer.getUserName()%>"; 
		      var userPass = "<%=userer.getUserPass()%>";
	          var flag = true;
	          var temp = "";
	          var mid = 0;
	          var tmp ;
	          if((document.getElementsByName("MyCheckBox").length+"")=="undefined"){
	            tmp=1;
	          }else{
	            tmp=document.getElementsByName("MyCheckBox").length;
	          }
	          if(tmp==1){
	            if(document.getElementsByName("MyCheckBox")[0].checked){
	              flag = false;
	              pho = document.getElementsByName("MyCheckBox")[i].value;
	              location="http://218.28.143.91/sendSmsadv.asp?username="+userName+"&password="+userPass+"&destaddr="+pho+"&content="+content;
	              //temp = document.getElementsByName("MyCheckBox")[0].value;
	            }
	          }else{
	              for(var i=0;i<document.getElementsByName("MyCheckBox").length;i++){
	                flag = false;
	                if(document.getElementsByName("MyCheckBox")[i].checked){
	                  pho = document.getElementsByName("MyCheckBox")[i].value;
	                  if(pho != ""){
	                     location="http://218.28.143.91/sendSmsadv.asp?username="+userName+"&password="+userPass+"&destaddr="+pho+"&content="+content;
	                     mid = mid + 1;
	                  }
	                  
	                }
	            }
	          }
	      if(flag){
	        alert("对不起，您还没有选择");
	        return false;
	      }else{
	        var tt = "你是成功发送了"+mid+"条短信";
	        alert(tt);
	      }
	     }
		</script>
	</head>
	<body bgcolor="#4194E7" leftmargin="0" topmargin="0" marginheight="0"
		marginwidth="0">
		<form name="form1" id="form1" action="#" method="post" />
		<table cellspacing="0" cellpadding="0" align="center" width="100%"
			cellspacing="20">
			<tr>
				<td bgcolor="#0650D2" align="center" height="25" class="lm_title">
					选 择 专 家
				</td>
			</tr>
			<Tr>
				<td align="center">
					<table cellpadding="1" cellspacing="0" align="center" width="100%"
						class="main_table">
						<tr >
						    
							<Td align="right" width="20%">
							    <input type="button" value="全选" onclick="selectAll()" />
							    <br/>
							</Td>
							<Td align="left">
							 <table>
							     <%
								    LeaderDAO leaderDao = new LeaderDAO();
								    Leader leader = new Leader();
								    List li = leaderDao.findAll();
								    int mid = 0;
								  %>
							   <tr>
								  <%
								      for(int i = li.size()-1 ; i >= 0;i--){
								       leader = (Leader)li.get(i);
								       mid = mid + 1;
								       if(mid % 6 == 0){
								   %>
								    <td>
								     <input type="checkbox" name="MyCheckBox" id="MyCheckBox"
													value="<%=leader.getMessagePho() %>" /><%=leader.getLeaderName() %>
								   </td>
								   </tr>
								   <tr>
								   <%}else{ %>
								   <td>
								     <input type="checkbox" name="MyCheckBox" id="MyCheckBox"
													value="<%=leader.getMessagePho() %>" /><%=leader.getLeaderName() %>
								   </td>
								  <% 
								  }
								    }
								  %>
							  </tr>
							  </table>
							</Td>
						</tr>
						
						<tr>
							<Td align="right">
								内容：
							</Td>
							<Td>
							  <textarea name="content" id="content" cols="40" rows="10" style=" SCROLLBAR-FACE-COLOR: rgb(31,111,191);
 SCROLLBAR-HIGHLIGHT-COLOR:#F0F0F0;
 SCROLLBAR-SHADOW-COLOR:#F0F0F0 ;
 SCROLLBAR-3DLIGHT-COLOR: #F0F0F0;
 SCROLLBAR-ARROW-COLOR: #F0F0F0;
 SCROLLBAR-TRACK-COLOR: #F0F0F0;
 SCROLLBAR-BASE-COLOR: #F0F0F0;"></textarea>
						    </Td>
						</tr>
						
					</table>
				</td>
			</Tr>
			<tr>
				<td bgcolor="#0650D2" align="center" height="25" class="lm_title">
					<input type="button" value="发送" onclick="sendInfo();"/>
				</td>
			</tr>
			<tr>
				<td height="10"></td>
			</tr>
			<Tr>
				<td bgcolor="#0650D2" align="center" height="25" class="lm_title">
					Copyright 2008-2009 &copy; 登封市财政局 All Rights Reserved.
				</td>
			</Tr>
			
		</table>
	  </form>
	</body>
</html>

